
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

import 'package:get/get.dart';
import 'package:myapp/app/theme/app_color.dart';

import '../controllers/action_chip_controller.dart';

class ActionChipView extends GetView<ActionChipController> {
  Widget _buildDrawChip() {
    return Container(
      child: RawChip(
        onDeleted: () {
          Fluttertoast.showToast(msg: "删除");
        },
        deleteIconColor: AppColor.red80,
        deleteButtonTooltipMessage: "删除",
        deleteIcon: Icon(Icons.delete),
        avatar: CircleAvatar(
          child: Text("V"),
        ),
        label: Text(
          "RawChip 不可用",
        ),
      ),
    );
  }

  Widget _buildClickRawChip() {
    return Container(
      child: Obx(
        () => RawChip(
          selected: controller.select.value,
          selectedColor: AppColor.orange,
          selectedShadowColor: AppColor.red80,
          onSelected: (v){
            controller.to();
          },
          label: Text(
            "Chip",
          ),
        ),
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('ActionChipView'),
        centerTitle: true,
      ),
      body: Center(
        child: Column(
          children: [
            _buildDrawChip(),
            _buildClickRawChip(),
          ],
        ),
      ),
    );
  }
}
